package ooday03;

/**
 * @author Huangjin
 * @version 1.0
 * describe:
 * @date 2023/2/22 17:31
 */
public class Test {
    public static void main(String[] args) {
        Dog[] dogs = new Dog[3];
        dogs[0] = new Dog("大狼",3,"黑");
        dogs[1] = new Dog("小黑",2,"白");
        dogs[2] = new Dog("小灰",4,"蓝");
        //输出第一只狗狗的名字
        System.out.println(dogs[0].name);
        //修改地儿直勾勾地年龄为4
        dogs[1].age = 4;
        //第三只狗狗在游泳
        dogs[2].swim();
        //遍历dogs数组
        for (int i = 0; i < dogs.length; i++) {
            System.out.println(dogs[i].name);
            //每只狗狗都吃饭
            dogs[i].eat();
        }
        Chick[] chicks = new Chick[2];
        chicks[0] = new Chick("小乌",2,"黑");
        chicks[1] = new Chick("小黄",3,"黄");
        for (int i = 0; i < chicks.length; i++) {
            System.out.println(chicks[i].name);
            chicks[i].eat();
        }
        Fish[] fish = new Fish[3];
        fish[0] = new Fish("小金",90,"金");
        fish[1] = new Fish("烤鱼",2,"金黄");
        fish[2] = new Fish("酸菜鱼",3,"黑");
        for (int i = 0; i < fish.length; i++) {
            System.out.println(fish[i].name);
            fish[i].eat();
        }

    }
}
